import axios from 'axios';

// 配置DeepSeek的API密钥和base_url
const baseUrl = 'https://api.deepseek.com/v1'; // 或者 'https://api.deepseek.com'
const apiKey = process.env.NEXT_PUBLIC_TEST_DEEPSEEK_API_KEY;

export async function getDeepSeekResponse(prompt) {
    try {
        const response = await axios.post(
            `${baseUrl}/chat/completions`,
            {
                model: 'deepseek-chat', // 替换为适当的模型名称
                messages: [{ role: 'user', content: prompt }],
            },
            {
                headers: {
                    'Authorization': `Bearer ${apiKey}`,
                    'Content-Type': 'application/json',
                },
            }
        );

        const message = response.data.choices[0].message.content;

        console.log("DeepSeek response:", message);

        return message;
    } catch (error) {
        console.error("Error getting response from DeepSeek:", error);
    }
}